NLP2SQL in Dialog
In this section, we will discuss how we can use NLP2SQL in our use cases. NLP2SQL can be added to the dialog from the rule editor in the UCD Dialog side-nav.
The default OTB rule has its own set of pre-defined ways of connecting with DB APIs and assuming an array of objects coming as objects and using adaptive cards and column set to represent data to display on teams chat window, and currently just an array of JSON is in the web chat window.
Parameters
| Parameters | Description |
| skillId | It’s a mandatory parameter. The skillId mentioned here should be an NLP2SQL Skill. If not found this parameter, the error thrown is “For NLP2SQL skillId is mandatory parameters in rule”. Any other skillId mentioned will throw error “The inserted Skill id is not an NLP2SQL skill. Please recheck.” If skillId mentioned is missing, then “No skill found. Please re-check your skillId.” |
| fallback_message | It’s an optional parameter. It indicates there was an issue while generating the SQL query. Its default value is “Could you rephrase the query” |
| parameter_name | It’s an optional parameter. It indicates that only query is required. It takes Boolean value. By default, it’s taken as false. |
| form_body_type | It’s an optional parameter. It is mentioning the DB API URL. If not found. It sends back the query generated. |
| request_method | It’s an optional parameter. Its possible values are POST and GET. By default, it’s always POST. If any other method value is encountered the message appearing is “The request method allowed are only POST & GET.” |
| request_header | It’s an optional parameter. |
| It’s an optional parameter. To indicate the SQL query to be sent to API by what name. By default, the parameter name to mention SQL query is “query”. | |
| It is an optional parameter. It indicates in what form data is getting passed to API. Its values are “Json”, “formBody”, “urlencoded”. By default, it’s taken as “Json” | |
| on_api_error_message | It is an optional parameter. It is used for sending the error message if any error occurs on API Call. Its default value is “'There is an error on the API call as: ' + API error message” |
| on_empty_message | It is an optional parameter. It is used to send a message when no data found for the query entered. Its default value is “No data present for the query.” |
The user has the full right to create his own DB API call with more parameters to send and to represent the data on chat windows using the Integration Console and openwhisk.
In this feature, we introduce a new idea called the "pre-execution handler”.